package k.lhl.test

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import k.lhl.adapter.RecyclerAdapter
import k.lhl.ext.TDialog
import k.lhl.ext.click
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.item_play_source.view.*

class MainActivity : AppCompatActivity() {
    private val playList = mutableListOf<PlaySource>()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val mToolbar: Toolbar = findViewById<View>(R.id.toolbar) as Toolbar
        setSupportActionBar(mToolbar)
        supportActionBar!!.setDisplayHomeAsUpEnabled(true)
        mToolbar.setNavigationOnClickListener {
            onBackPressed()
        }

        for (i in 0 until 5) {
            playList.add(PlaySource("资源${i + 1}"))
        }
        listPlay.mRecyclerView.isNestedScrollingEnabled = false
        listPlay.setAdapter(playList) {
            tvTitle.text = it.source
        }

        imgVideo.click {
            TDialog("哈哈哈").setButtons({},{})
        }


    }


}
